package org.kingtop.mybatis.persistence.metamodel;

import org.apache.ibatis.type.JdbcType;

import java.io.Serializable;
import java.util.Map;

/**
 * 用于记录model类的对应于数据库的字段的信息
 *
 * @author 陈金波
 * @date 2018年1月4日 上午9:26:33
 * @Copyright: 2018 chen jinbo. All rights reserved.
 */
public class TableField implements Serializable {

	public static final String SEQUENCE_PARAM_NAME = "sequence";
	public static final String REDIS_KEY_PARAM_NAME = "redisKey";

	/**
	 * 
	 */
	private static final long serialVersionUID = -4157049823304073864L;

	/**
	 * java中字段的名称
	 */
	private String javaFieldName;

	/**
	 * 数据库字段名称
	 */
	private String dbFieldName;

	/**
	 * java的字段类型
	 */
	private Class<?> javaType;

	/**
	 * 数据库字段对应的jdbc的类型
	 */
	private JdbcType jdbcType;

	/**
	 * 是否是排序字段
	 */
	private boolean order;

	/**
	 * 其他非通用信息
	 */
	private Map<String, String> params;

	/**
	 * @return the javaFieldName
	 */
	public String getJavaFieldName() {
		return javaFieldName;
	}

	/**
	 * @param javaFieldName
	 *            the javaFieldName to set
	 */
	public void setJavaFieldName(String javaFieldName) {
		this.javaFieldName = javaFieldName;
	}

	/**
	 * @return the dbFieldName
	 */
	public String getDbFieldName() {
		return dbFieldName;
	}

	/**
	 * @param dbFieldName
	 *            the dbFieldName to set
	 */
	public void setDbFieldName(String dbFieldName) {
		this.dbFieldName = dbFieldName;
	}

	public Class<?> getJavaType() {
		return javaType;
	}

	public void setJavaType(Class<?> javaType) {
		this.javaType = javaType;
	}

	/**
	 * @return the jdbcType
	 */
	public JdbcType getJdbcType() {
		return jdbcType;
	}

	/**
	 * @param jdbcType
	 *            the jdbcType to set
	 */
	public void setJdbcType(JdbcType jdbcType) {
		this.jdbcType = jdbcType;
	}

	/**
	 * @return the params
	 */
	public Map<String, String> getParams() {
		return params;
	}

	/**
	 * @param params
	 *            the params to set
	 */
	public void setParams(Map<String, String> params) {
		this.params = params;
	}

	public boolean isOrder() {
		return order;
	}

	public void setOrder(boolean order) {
		this.order = order;
	}
}
